//
//  HpBrandModel.swift
//
//  Created by eme on 2016/12/15
//  Copyright (c) . All rights reserved.
//

import Foundation
import SwiftyJSON
import ModelProtocol

public class HpBrandModel: ModelProtocol {
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let kHpBrandBrnameKey: String = "brname"
    internal let kHpBrandBrdateKey: String = "brdate"
    internal let kHpBrandBrlogourlKey: String = "brlogourl"
    internal let kHpBrandBrinfoKey: String = "brinfo"
    internal let kHpBrandSelfidKey: String = "selfid"
    internal let kHpBrandBridKey: String = "brid"
    internal let kHpBrandBdidKey: String = "bdid"
    internal let kHpBrandSortnumKey: String = "sortnum"
    internal let kHpBrandBriseffectiveKey: String = "briseffective"
    internal let kHpBrandBrinfourlKey: String = "brinfourl"
    internal let kHpBrandSendtypeKey: String = "sendtype"
    internal let kHpBrandBrcodeKey: String = "brcode"
    
    
    // MARK: 属性
    public var brname: String
    public var brdate: String
    public var brlogourl: String
    public var brinfo: String
    public var selfid: String
    public var brid: String
    public var bdid: String
    public var sortnum: Int
    public var briseffective: String
    public var brinfourl: String
    public var sendtype: String
    public var brcode: String
    public var colcount: Int
    public var cid: String
    public var pdcount: Int
    
    
    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    public required  init?(json: JSON) {
        brname = json[kHpBrandBrnameKey].stringValue
        brdate = json[kHpBrandBrdateKey].stringValue
        brlogourl = json[kHpBrandBrlogourlKey].stringValue
        brinfo = json[kHpBrandBrinfoKey].stringValue
        selfid = json[kHpBrandSelfidKey].stringValue
        brid = json[kHpBrandBridKey].stringValue
        bdid = json[kHpBrandBdidKey].stringValue
        sortnum = json[kHpBrandSortnumKey].intValue
        briseffective = json[kHpBrandBriseffectiveKey].stringValue
        brinfourl = json[kHpBrandBrinfourlKey].stringValue
        sendtype = json[kHpBrandSendtypeKey].stringValue
        colcount = json["colcount"].intValue
        cid = json["colflag"].stringValue
        pdcount = json["pdcount"].intValue
        brcode = json[kHpBrandBrcodeKey].stringValue
        
    }
    
    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    public func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        
        dictionary.updateValue(brname as AnyObject, forKey: kHpBrandBrnameKey)
        
        dictionary.updateValue(brdate as AnyObject, forKey: kHpBrandBrdateKey)
        
        dictionary.updateValue(brlogourl as AnyObject, forKey: kHpBrandBrlogourlKey)
        
        dictionary.updateValue(brinfo as AnyObject, forKey: kHpBrandBrinfoKey)
        
        dictionary.updateValue(selfid as AnyObject, forKey: kHpBrandSelfidKey)
        
        dictionary.updateValue(brid as AnyObject, forKey: kHpBrandBridKey)
        
        dictionary.updateValue(bdid as AnyObject, forKey: kHpBrandBdidKey)
        
        dictionary.updateValue(sortnum as AnyObject, forKey: kHpBrandSortnumKey)
        
        dictionary.updateValue(briseffective as AnyObject, forKey: kHpBrandBriseffectiveKey)
        
        dictionary.updateValue(brinfourl as AnyObject, forKey: kHpBrandBrinfourlKey)
        
        dictionary.updateValue(sendtype as AnyObject, forKey: kHpBrandSendtypeKey)
        
        dictionary.updateValue(brcode as AnyObject, forKey: kHpBrandBrcodeKey)
        
        return dictionary
    }
    
    
}
